<style type="text/css">
    .tablelist td{line-height:26px;}
    .tablelist tbody tr.odd {background:#E3F0FA}
    .giveorder{background:#26B99A;color:white;padding:3px 4px;border-radius:3px;margin-bottom: 5px;}
    .giveorder:hover{color:white;background:#169F85}
.form-control{padding:0;}
.col-md-55, .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12{padding:0;}
.col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9{padding-left:2px;padding-right:0;}
.form-inline .form-control{border-radius:3px;padding-left:2px;}
</style>
<form class="form-inline" method="get">
    <p>总预约数量：{:config('setting')['apply_num']}</p>
    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <input class="form-control" name="realname" value="{$realname}"
                   placeholder="用户名或真实姓名">
        </div>
    </div>
    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <input class="form-control" name="selfphone" value="{$selfphone}"
                   placeholder="手机号">
        </div>
    </div>
    <div class="form-group col-xs-1">
        <div class="col-xs-12">
            <select class="form-control" name="is_levfix" id="is_levfix">
                <option value=''   {if $is_levfix=== ''}selected{/if} >全部</option>
                <option value='0'   {if $is_levfix === '0'}selected{/if} >未处理</option>
                <option value='2' {if $is_levfix eq '2'}selected{/if} >已返还</option>
                <option value='1' {if $is_levfix eq '1'}selected{/if} >已扣除</option>
            </select>
        </div>
    </div>

    <div class="form-group col-xs-1">
        <div class="col-xs-12">
            <select class="form-control" name="point_status" id="point_status">
                <option value=''   {if $point_status=== ''}selected{/if} >全部类型</option>
                <option value='2' {if $point_status eq '2'}selected{/if} >已指定</option>
                <option value='1' {if $point_status eq '1'}selected{/if} >未指定</option>
            </select>
        </div>
    </div>

    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            {include file="public/dateRangePicker" picker-name="time_range"/}
        </div>
    </div>

    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <select class="form-control" name="good_id" id="good_id">
                <option value=''   {if $good_id== 0}selected{/if} >全部</option>
                {foreach $good_list as $g}
                <option value='{$g.id}'   {if $good_id== $g['id']}selected{/if} >{$g.title}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <button type="submit" class="btn btn-success">
                确认搜索
            </button>
        </div>
    </div>
</form>
<hr>
<table class="table table-striped">
    <thead>
    <tr>
        <td>编号</td>
        <th>预约产品</th>
        <th>用户（总金额）</th>
        <th>当时IP</th>
        <th>消费共享豆</th>
        <th>创建时间</th>
        <th>预约状态</th>
        <th>是否指定</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {volist name="list" id="item"}
    <tr>
        <td>{$item.id}</td>
        <td>
            <p>{$item.title}</p>
            {if $item.status eq 0}
            {if condition="$item['point_status'] eq 2"}
              <p><a href='{:url("Shop/deleteapplys",["id"=>$item["id"]])}' class='label label-info'>抹掉</a></p>
            {/if}
            {/if}

        </td>
        <td>
            <p>{$item.uid|get_uname}( {$item.uid|usercansale} )</p>
            <p>{$item.uid|get_telcode}</p>
            <p>推荐人：<label class="label label-info">{$item.uid|getParentInfo}</label></p>
        </td>
        <td>
            <p>{$item.ipstr}</p>
            <p>总资产:{$item.uid|user_pro_money}</p>    
        </td>
        <td>
            {if condition="$item['isadd'] eq 1"}+{/if}
            {if condition="$item['isadd'] eq 2"}-{/if}
            {$item.delpoint|intval}
        </td>
        <td>
            {$item.ctime|date='Y-m-d H:i:s',###}
        </td>
        <td>
            {if condition="$item['status'] eq 0" }未处理{/if}
            {if condition="$item['status'] eq 1" }已扣除{/if}
            {if condition="$item['status'] eq 2" }<span style='color:#999'>已返还</span>{/if}
        </td>
        <td>
            {if condition="$item['point_status'] eq 1"}未指定{/if}
            {if condition="$item['point_status'] eq 2"}<span style='color:#999'>已指定</span>{/if}
        </td>
        <td>
          {if condition="$item['status'] eq 0" }
            {if $item['point_status'] eq 1}
            <a onclick="modal('{:url(\'Shop/giveorder\',[\'id\'=>$item['id']])}', '指定购买订单', '80%', '80%')" class='giveorder label'>指定新生订单</a>
            <a onclick="modal('{:url(\'Shop/giveexistorder\',[\'id\'=>$item['id']])}', '指定已存在订单', '80%', '450px')" class='giveorder label'>指定已存在订单</a>
            {else}
            如若需要重新指定 <br>清先抹掉之前指定的信息
            {/if}
          {/if}
          {if condition="$item['status'] neq 0" }仅限未处理订单{/if}
        </td>
    </tr>
    {/volist}
    </tbody>
</table>

<div class="row">
    <div class="col-xs-12" style="text-align: right;">
        {$list->render()}
    </div>
</div>
<script src="__PUBLIC__/vendors/select2/js/select2.min.js"></script>
<script type="text/javascript">
    $('.tablelist tbody tr:odd').addClass('odd');
    $(function () {
        $("#is_levfix").select2({
            placeholder: "预约状态",
            allowClear: true
        });
        $("#good_id").select2({
            placeholder: "预约产品",
            allowClear: true
        });
    });
</script>
